<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<?php
/**
 * Created by PhpStorm.
 * User: dapeng
 * Date: 2018/9/27
 * Time: 下午4:56
 */


$id = $_GET['id'];


//通过ID去查询
try{
    $pdo = new PDO("mysql:host=localhost;dbname=test","root","");
}catch (Exception $e){
    var_dump($e);
    die("连接失败");
}

$res = $pdo->query("select * from tbl_user where  id = $id");
//if(is_array($res)) {
    foreach ($res as $user) {

        ?>

        <form method="post" action="editUser.php" class="am-form">
            <label for="name">姓名:</label>
            <input type="text" name="name" id="name" value="<?php echo $user['name'] ?>">
            <br>
            <!-- <label for="no">学号:</label>
    <input type="number" name="no" id="no" value="<?php echo $user['no'] ?>">
    <br> -->

            <label for="tel">电话:</label>
            <input type="tel" name="tel" id="tel" value="<?php echo $user['tel'] ?>">
            <br>

            <label for="age">年龄:</label>
            <input type="text" name="age" id="age" value="<?php echo $user['age'] ?>">
            <br>

            <label for="id">编号:</label>
            <input type="text" name="id" id="id" value="<?php echo $user['id'] ?>">
            <br>
            <br/>
            <div class="am-cf">
                <input type="submit" name="" value="保   存" class="am-btn am-btn-primary am-btn-sm am-fl">
                <!--<input type="submit" name="" value="忘记密码 ^_^? " class="am-btn am-btn-default am-btn-sm am-fr">-->
            </div>
        </form>


    <?php //}
}?>
